package handler

import (
	"github.com/gin-gonic/gin"
	"trpg-base/entity"
	"trpg-common/request"
	"trpg-common/response"
)

type LabelHandler struct{}

func (LabelHandler) AddLabel(c *gin.Context) {
	label := entity.Label{}
	request.GetStructFromGinContext(c, &label)
	user := request.GetUserFromGinContext(c)
	response.SuccessWithData(c, labelService.AddLabel(label, user))
}

func (LabelHandler) GetLabels(c *gin.Context) {
	labelType := request.GetIntFromPath(c, "type")
	response.SuccessWithData(c, labelService.GetLabelList(int32(labelType)))
}
